<template>
  <div>
    <el-table
      ref="multipleTable"
      :data="tableData"
      tooltip-effect="dark"
      style="width: 100%"
      :@selection-change="handleSelectionChange()"
    >
      <el-table-column type="selection" width="55"> </el-table-column>
      <el-table-column label="编号" show-overflow-tooltip>
        <template slot-scope="scope">
          <b>{{ scope.row.id }}</b>
        </template>
      </el-table-column>
      <el-table-column prop="username" label="账号" show-overflow-tooltip>
      </el-table-column>

      <el-table-column label="角色编号" show-overflow-tooltip>
        <template slot-scope="scope">
          <span v-for="(role, index) in scope.row.roles" :key="index">
            <b>{{ role.id }}</b>
          </span>
        </template>
      </el-table-column>
      <el-table-column label="角色" show-overflow-tooltip>
        <template slot-scope="scope">
          <span v-for="(role, i) in scope.row.roles" :key="i">
            {{ role.name }}
          </span>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  name: "HealthVueAlluser",

  data() {
    return {
      tableData: [],
      multipleSelection: [],
    };
  },
  methods: {
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
  },
  beforeCreate() {
    this.$http
      .get("/user.do")
      .then((res) => {
        this.tableData = res.data;
      })
      .catch((err) => {
        console.log(err);
      });
  },
};
</script>

<style>
</style>